import {
  createRouter,
  createWebHistory,
  type RouteRecordRaw,
} from "vue-router";
import Home from "../views/Home.vue";
import Phone from "../components/Phone.vue";
import Laptop from "../components/Laptop.vue";
import Accessory from "../components/Accessory.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    component: Home,
    redirect: "/phone", // 默认显示手机页面
    children: [
      { path: "phone", component: Phone },
      { path: "laptop", component: Laptop },
      { path: "accessory", component: Accessory },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
